<?php


	$lp_root_path='../';
	$general_root_path = '../../';

	define('INSIDE', true);
	include($general_root_path . 'extension.inc');
	include($general_root_path . 'common.'.$phpEx);
include_once($lp_root_path. 'classes/templates.class.'.$phpEx);
include_once($lp_root_path. 'procedures.class.'.$phpEx);
include_once($lp_root_path. 'classes/json_data_classes.'.$phpEx);

$dentro=check_user();


$user_id = $_SESSION['id_usuario'];

$result = new json_request();

/*
ERROR LIST:

-1		->	No session
-2		->	No request data, missing "jsondata" parameter
-3		->	Type not implemented
-4		->	Operation not implemented
-5		->	Exception

*/

if(!$dentro)
{
	$result->error=1;
	$result->error_number=-1;
	echo "no_session";
}
else
{
	/*if($jsonraw==null)
	{
		$result->error=1;
		$result->error_number=-2;
		echo "bad_request";
	}
	else
	{*/
		/*$jsonraw = str_replace('\"','"',$jsonraw);
		$request = new json_request();
		$request->load(json_decode($jsonraw));*/

		
		$sp = new procedures();

		try
		{
			$row = $sp->sp_planets_getFromUser($user_id);
		}
		catch (exception $e)
		{
			die($e->getMessage());
		}
	/*}*/
}

foreach($row as $dataRow)
{
	echo '<p id="'.$dataRow["id"].'"><span>'.$dataRow["name"].'</span><span>('.$dataRow["position"].')</span></p>';
}

?>
